gtk-demo: Fix a memory leak
authorMatthias Clasen <mclasen@redhat.com>
Fri, 7 Aug 2020 19:15:18 +0000 (15:15 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 7 Aug 2020 19:15:18 +0000 (15:15 -0400)
The colors demo was leaking a reference to its model.
This was showing up as crash when you manage to close
both the demo window and the main window while the
sorting is ongoing.

demos/gtk-demo/listview_colors.c

index b63f2366e013bd49fa5f3eea100fba495b4c2edf..c8cf07cdba82bc6dd9c87fb284d22d08012f3189 100644 (file)
@@ -1118,6 +1118,8 @@ do_listview_colors (GtkWidget *do_widget)
       gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
 
       g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
+
+      g_object_unref (selection);
     }
 
   if (!gtk_widget_get_visible (window))